import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { ArticleModule } from './article/article.module';
import { UserAccountModule } from './user_account/user_account.module';
import { MessageModule } from './message/message.module';
import { WebsocketModule } from './websocket/websocket.module';


@Module({
  imports: [TypeOrmModule.forRoot({
    type: 'mysql',
    host: 'localhost',
    port: 3306,
    username: 'root',
    password: 'root',
    database: 'myblog',
    // entities: [__dirname + '/**/*.entity{.ts,.js}'],
    synchronize: true,
    retryDelay: 500, //重试连接数据库间隔
    retryAttempts: 10,//重试连接数据库的次数
    autoLoadEntities: true, //如果为true,将自动加载实体 
  }), UserAccountModule, ArticleModule, MessageModule, WebsocketModule],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule { } 
